<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested" %>

<html>
   <head>
   </head>
   <body>
    <html:form action="/madmin" >
   <table border="0" align="center" width="70%" bordercolor="yellow">
<%--        <tr>
           <td align="center">
               <table border="0" width="100%" class="radiotable">
                  <tr>
                      <td width="25%" class="leftlabel">Select the operation:</td>
                      <td width="2%" nowrap>&nbsp;</td>
	                  <td width="3%"><html:radio property="operation" value="addition" onclick="submitForm('/madmin.do?action=display')"/></td>
	                  <td width="8%" class="leftlabel">Add</td>
	                  <td width="3%"><html:radio property="operation" value="subtraction" onclick="submitForm('/madmin.do?action=display')"/></td>
	                  <td width="8%" class="leftlabel">Subtract</td>
	                  <td width="3%"><html:radio property="operation" value="multiplication" onclick="submitForm('/madmin.do?action=display')"/></td>
	                  <td width="8%" class="leftlabel">Multiply</td>
	                  <td width="3%"><html:radio property="operation" value="division" onclick="submitForm('/madmin.do?action=display')"/></td>
	                  <td width="8%" class="leftlabel">Divide</td>
	                  <td width="3%"><html:radio property="operation" value="random" onclick="submitForm('/madmin.do?action=display')"/></td>
	                  <td width="8%" class="leftlabel">Random</td>
	                  <td width="28%" nowrap>&nbsp;</td>
	               </tr>
               </table>
           </td>
       </tr> --%>
       <logic:empty name="mmaf" property="operation">
       <tr>
           <td align="center">
               <table border="0" width="100%" class="radiotable">
                  <tr>
                  	  <td width="25%" class="leftlabel">Select an operation:</td>
                  	  <% int percentage = 25; %>
                      <nested:iterate name="mmaf" property="radioData" id="row">
       	 				<nested:define id="answer" property="answer"/>
       	 				<nested:define id="display" property="display"/>
       	 				<td width="3%">
       	 					<input type="radio" name="operation" value="<%=answer%>" onClick="submitForm('/madmin.do?action=display')" />
						</td>
       	 				<td width="8%" class="leftlabel"><%=display%></td>
       	 				<% percentage += 11; %>
     	 			  </nested:iterate>
     	 			  <td width="<%=100-percentage %>" nowrap>&nbsp;</td>
	               </tr>
               </table>
           </td>
       </tr>        
       </logic:empty>
       
       <logic:notEmpty name="mmaf" property="operation">
      <tr>
           <td>
           		<table>
           			<tr>
           				<td class="labelmedium">Chosen Operation:</td>
           				<td>&nbsp;</td>
           				<td><nested:write property="operation"/></td>
           				<td>&nbsp;</td>
           				<td>&nbsp;</td>
           				<td>Click here <a class="bluelink" href="<%=request.getContextPath()%>/madmin.do?action=home">here</a> to start again.</td>
           			</tr>
           		</table>
           </td>
       </tr>       
       </logic:notEmpty>
      
 
       <nested:empty name="mmaf" property="pagedata">
      <tr>
           <td>&nbsp;</td>
       </tr>       
       <tr>
           <td>   
           <p><b>Read the following carefully</b></p>
           <p>Once you select an operation, the screen displays sums and you will have to complete them in a minute. After one minute, the screen auto-
              matically display the next screen that shows your scores.</p>
           <p>If you have answered the questions within one minute, please press done button.</p>  
           <p>Press tab (on your keyboard) to move to different answer box(es).</p>  
           </td>
       </tr>    
       </nested:empty>

       <nested:notEmpty name="mmaf" property="pagedata">
       <tr>
           <td align="left">
                <input type="button" name="done" value="Done" onclick="submitForm('/madmin.do?action=process')">
           </td>
       </tr>

       	<tr>
       	    <td align="center">
       	       <table border="1">
       	          <nested:iterate property="pagedata" indexId="sumnumber">
       	              <nested:equal property="startRow" value="true">
           	            <tr>
           	          </nested:equal>
           	             <td> 
	           	             <table>
	           	                <tr> 
					               <td class="problemnum" width="50"><%=sumnumber.intValue() + 1%>.</td>
					               <td><nested:write property="htmlData" filter="false"/></td>
					               <td><img src="<%=request.getContextPath()%>/image/empty.gif"></td>
					            </tr>
					         </table>
					     </td>      	      
       	              <nested:equal property="endRow" value="true">
           	            </tr>
           	          </nested:equal>
           		  </nested:iterate>
       		   </table>
       	    </td>
        </tr>

       <tr>
           <td align="right">
                <input type="button" name="done" value="Done" onclick="submitForm('/madmin.do?action=process')">
           </td>
       </tr>

	   <script>
	      setTimeout("submitForm('/madmin.do?action=process')", 10000);
	   </script>
       </nested:notEmpty>

   </table>
 </html:form> 

</body>
</html>